package com.klangner.behaviors
{
  import com.klangner.geom.Vector2D;
  
  import flash.display.Sprite;

  public class Circle extends Sprite
  {
    private var _radius:Number = 200;
    private var _color:uint = 0x0000ff;

    public function Circle(position:Vector2D){
      x = position.x;
      y = position.y;
      updateGraphics();
    }
    
    public function get radius():Number{
      return _radius;
    }

    public function set radius(r:Number):void{
      _radius = r;
      updateGraphics();
    }

    public function setColor(red:int, green:int, blue:int):void{
      
      _color = red << 16 | green << 8 | blue;
      updateGraphics(); 
    }

    private function updateGraphics():void{
      graphics.clear();
      graphics.lineStyle(1, _color);
      graphics.drawCircle(0, 0, _radius);
      graphics.beginFill(_color);
      graphics.drawCircle(0, 0, 2);
      graphics.endFill();

    }
  }
}